package cn.com.joycode.nimble.core.lang;

import cn.com.joycode.nimble.core.utils.ObjectMapperUtil;
import lombok.extern.slf4j.Slf4j;

import java.nio.charset.StandardCharsets;

/**
 * @author Max Woods
 * @since 1.0
 */

@Slf4j
public abstract class AbstractNbObject implements NbObject {

    @Override
    public String toString() {
        return ObjectMapperUtil.toJsonString(this);
    }

    @Override
    public byte[] toBytes() {
        return this.toString().getBytes(StandardCharsets.UTF_8);
    }
}
